<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/maa.tld" prefix="m" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setLocale value="${language}"/>
<fmt:bundle basename="messages" prefix="groups.">

    <html>
    <head>
        <title><fmt:message key="title"/></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/static/bootstrap/css/bootstrap.css">
        <link href="${pageContext.request.contextPath}/css/groups.css" rel="stylesheet">
        <link rel="shortcut icon" href="${pageContext.servletContext.contextPath}/static/yin.ico">
        <script type="text/javascript"
                src="${pageContext.servletContext.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
        <style type="text/css"></style>
    </head>

    <body>
    <div class="navbar-wrapper">
        <div class="container-fluid">
            <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse"
                                data-target=".navbar-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="/maa/do?action=main"> <img
                                src="${pageContext.servletContext.contextPath}/static/ics.png"/>Silver Dragon</a>
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a><strong><fmt:message key="greet"/> ${user.name} ${user.surname}!</strong></a>
                            </li>
                            <li><a href="/maa/do?action=admin-cabinet"><fmt:message key="cabinet"/></a></li>
                            <li><a href="/maa/do?action=main"><fmt:message key="main"/></a></li>
                            <li>
                                <form action="/maa/do" method="post">
                                    <input type="hidden" name="action" value="logout">
                                    <input class="btn btn-default" type="submit"
                                           value="<fmt:message key="logout"/>"/>
                                </form>
                            </li>
                            <m:language/>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="row row-offcanvas row-offcanvas-right">
            <div class="col-xs-12 col-sm-9">
                <p class="pull-right visible-xs">
                    <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>
                </p>
                <div class="jumbotron">
                    <c:if test="${not empty user}">
                        <h1><fmt:message key="dear"/> ${user.name},</h1>
                    </c:if>

                    <p><fmt:message key="mes"/></p>
                </div>
                <div class="row">
                    <c:forEach items="${groups}" var="group">
                        <div class="col-6 col-sm-6 col-lg-4">
                            <h2>${group.course.courseName}</h2>

                            <ol>
                                <c:forEach items="${group.userList}" var="user">
                                <li><p>  ${user.name} ${user.surname}
                                    </c:forEach>
                            </ol>

                        </div>
                    </c:forEach>
                </div>
            </div>
            <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation">
                <div class="list-group">
                    <a href="/maa/do?action=main" class="list-group-item"><fmt:message key="main"/></a>
                    <a href="/maa/do?action=courses" class="list-group-item"><fmt:message key="courses"/></a>
                    <a href="/maa/do?action=mentors" class="list-group-item"><fmt:message key="mentors"/></a>
                    <c:if test="${not empty user and user.role == 'ADMIN'}">
                        <a href="/maa/do?action=groups" class="list-group-item"><fmt:message key="groups"/></a>
                    </c:if>
                </div>
            </div>
        </div>
    </div>

    <script src="./Off Canvas Template for Bootstrap_files/jquery.min.js"></script>
    <script src="./Off Canvas Template for Bootstrap_files/bootstrap.min.js"></script>
    <script src="./Off Canvas Template for Bootstrap_files/offcanvas.js"></script>


    </body>
    </html>

</fmt:bundle>